//
//  main.cpp
//  CPP
//
//  Created by wangrui on 14-5-4.
//  Copyright (c) 2014年 PPS. All rights reserved.
//

#include <iostream>


/*
 *overflow test
 *
 
 int main(int argc, const char * argv[])
 {
     short x = -32768; //有符号,2个字节，范围 (-32768) - (+32767)
     unsigned short  y = 65535; //unsigned 告诉编译器最高位不当符号位 （0 - 65535）
     
     printf("%d \n",x);
     printf("%d \n",y);
     
     
     char c = 127;
     unsigned char uc = 255;
     printf("%d \n",c);
     printf("%d \n",uc);
     
     
     int i[] = {1,2};
     printf("%d \n",*(i+2)); //超界，输出的是int的最大值:2147418112
     
     float f[] = {2.0};
     printf("%f \n",f[1]);//超界，编译器警告 output:0.0000
     printf("%f \n",*(f + 2));//超界，编译器不警告 output:0.0000
     
 }
 
 */
 

/*
 * c++ 对像调用 static 类方法
 *
    class A
    {
        
    public:
        static void fun()
        {
            std::cout<<"fun"<<std::endl;
        }
    };


    int main(int argc, const char * argv[])
    {
        A a;
        a.fun(); //C++ 对象可以调用类方法
        
        return 0;
    }
*/



//静态对象调用构造函数问题

class obj
{
public:
    obj()
    {
        std::cout<<"constructor"<<std::endl;
    }
};


static obj o;

/*
 * 调用堆栈:
    1:加载二进制文件
    2:_GLOBAL_I_a
    3:_cxx_global_val_init //初始化全局变量
    4:_constructor
 */


int main(int argc, const char * argv[])
{
    return 0;
}

